export const requestGet = (url: string) => {
  return fetch(url, { headers: { "Content-Type": "application/json" } }).then(res => res.json()).catch(error => {
    console.error('requestGet => ', error)
    return error
  })
};

export const requestPost = (url: string, body: object = {}) => {
  const option = {
    method: 'POST',
    headers: { 'Content-type': 'application/json' },
    body: JSON.stringify(body),
  }
  return fetch(url, option).then(res => res.json()).catch(error => {
    console.error('requestPost => ', error)
    return error
  })
};